<?php
/**
 * Builds up a programmatic model for SQL GROUP BY clause to be used by SELECT query.
 */
class SQLGroupByClause extends AbstractSQLClause {
	/**
	 * Sets up group by fields directly from constructor. Syntax is array("column-name",...).
	 * 
	 * @example $tblColumns = array("a","b")
	 * @param array(string) $tblColumns
	 */
	public function __construct($tblColumns) {
		foreach($tblColumns as $strColumn) {
			$this->tblContents[] = $strColumn;
		}
	}
	
	/**
	 * Transforms clause to string
	 * @example a, b
	 * @see AbstractSQLClause::toString()
	 */
	public function toString() {
		return implode(", ",$this->tblContents);
	}
}